<%--
  Created by IntelliJ IDEA.
  User: 杨大贵
  Date: 2024/4/12
  Time: 19:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page pageEncoding="UTF-8" %>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>梯形面积计算结果</title>
    <style>
        #resultStyle {
            font-family: 宋体;
            font-size: 24px;
            color: blue;
        }
    </style>
</head>
<body bgcolor="#ffccff">
<jsp:useBean id="trapezoid" class="tom.jiafei.Trapezoid" scope="page" />
<%-- 通过useBean标签，创建一个名为trapezoid的Trapezoid对象，并设置作用范围为page --%>

<%
    double top = Double.parseDouble(request.getParameter("top"));
    double bottom = Double.parseDouble(request.getParameter("bottom"));
    double height = Double.parseDouble(request.getParameter("height"));

    trapezoid.setTop(top);
    trapezoid.setBottom(bottom);
    trapezoid.setHeight(height);

    double area = trapezoid.calculateArea();
%>

<div id="resultStyle">
    梯形的参数和面积值：<br>
    上底：<%= trapezoid.getTop() %><br>
    下底：<%= trapezoid.getBottom() %><br>
    高： <%= trapezoid.getHeight() %><br>
    面积： <%= area %>
</div>
</body>
</html>
